Skip to content

Text sound and images

Alt text

Alt text

ASCII code and Unicode

ASCII code

  • Text is converted to binary to be processed by a computer according to ASCII code.(8 bits per character)
DECOCTHEXBINSymbolHTML NumberDescription
651014101000001AAUppercase A
661024201000010BBUppercase B
671034301000011CCUppercase C
681044401000100DDUppercase D
691054501000101EEUppercase E
701064601000110FFUppercase F

Unicode

Unicode allows for a greater range of characters and symbols than ASCII, including different languages and emojis. (16 bits per character)

Alt text

Sound

  • A sound wave is sampled for sound to be converted to binary.
  • The sample rate is the number of samples taken in a second.
  • The sample resolution is the number of bits per sample.

Alt text

Sample rate

  • standard sampling rate is 44 100 samples per second.

Sample resolution

  • In audio CDs, each sample is recorded as a 16-bit integer.

Calculating audio file sizes

  • The file size = sampling rate x sampling resolution x seconds.

  • A 32-second sound clip will be recorded.

  • The sound will be sampled 16000 times a seconds.

  • Each sample will be stored using 8 bits.

16000 x 8 x 32 = 4096000 bits

Images

  • A pixel is a smallest element in a image, its color is represented by three component intensities such as red, green, and blue. (RGB)
  • The image resolution is the product of the width multiply with the height of the image.

Alt text

Colour depth

  • Colour depth is the number of bits used to indicate the color of a pixel.
  • Normally, we use 24 bits to represent the color of a pixel.
  • For example
  • #FF 00 00 represents primary colour red
  • #00 FF 00 represents primary colour green
  • #00 00 FF represents primary colour blue
  • #FF 00 FF represents fuchsia

Calculating bit-map image file sizes

  • The file size = image resolution x colour depth.

Alt text

  • The image has a resolution of 400 x 300 pixels, and a colour depth of 8 bits per pixel.

400 x 300 x 8 = 960000 bits